//
//  GetGroupListManager.m
//  17DianYing
//
//  Created by apple on 15/9/23.
//  Copyright (c) 2015年 apple. All rights reserved.
//

#import "GetGroupListManager.h"
#import "AFNetworking.h"

@interface GetGroupListManager()

@property (nonatomic,strong)AFHTTPRequestOperationManager *afManager;
@property(nonatomic,strong)GetGroupListManager *seedM;
@end

@implementation GetGroupListManager



+(instancetype)share
{
    static GetGroupListManager *m = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        m = [[GetGroupListManager alloc]init];
    });
    return m;
}

-(void)getListWithToken:(NSString *)token BlockHandle:(GetGroupListBLOCK)bh
{
    self.afManager = [[AFHTTPRequestOperationManager alloc]init];
    self.afManager.responseSerializer = [AFHTTPResponseSerializer serializer];
    
    NSString * url =[http stringByAppendingString:@"/mobile/group/freedomGroup/list"];
    
    
    
    NSDictionary * dic = @{@"token":token};
    
    AFHTTPRequestOperation *op = [self.afManager GET:url parameters:dic success:^(AFHTTPRequestOperation *operation, id responseObject) {
        id obj = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];
        NSLog(@"11111111111111111111111111111111111111111%@",obj);
        NSDictionary *dic = obj;
        bh(dic);
        NSLog(@"22222222222222222222222222222%@",dic);
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"%@",error.localizedDescription);
    }];

    [op start];

}

@end
